<template>
  <div>
    <el-row>
      <el-col>
        <header class="head">接口信息</header>
        <el-form label-width="100px">
          <el-form-item label="接口类型：">
             数据集
          </el-form-item>
          <el-form-item label="配置接口：">
            <el-button
              size="mini"
              type="primary"
              icon="el-icon-search"
              :disabled="isView"
              @click="visible = true"
            >查询数据集管理</el-button
            >
          </el-form-item>
          <el-form-item label="数据集名称：">
            {{ formData.datasetName || "" }}
          </el-form-item>
          <el-form-item label="查询SQL：">
            {{ formData.selectSql || "" }}
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
    <el-dialog
      width="1200px"
      v-el-drag-dialog
      append-to-body
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      v-model="visible"
      title="选择接口"
    >
      <step-xzsjj :fbOptions="fbOptions" v-if="visible" @onChoose="onChoose" />
      <dialog-footer slot="footer" :showCancle="false" @ok="onOk" />
    </el-dialog>
  </div>
</template>

<script>
import { selectById } from "@slc/api/slc/api";
import StepXzsjj from "../step-fhbp/step-xzsjj.vue";
export default {
  name: "custom-apiport-dataset",
  components: {
    StepXzsjj,
  },
  props: {
    fbOptions: {
      type: Object,
      default: () => {
      }
    },
  },
  data() {
    return {
      visible: false,
      chooseInfo: {},
    };
  },
  computed: {
    formData() {
      return this.fbOptions.flow.moreNodeInfo[this.fbOptions.flow.currentNodeId] || {};
    },
    isView() {
      return (
        this.fbOptions.operationType === "view"
      );
    },
  },
  methods: {
    onChoose(val) {
      this.chooseInfo = val;
    },
    onOk() {
      this.visible = false;
      this.fbOptions.flow.moreNodeInfo = {
        ...this.fbOptions.flow.moreNodeInfo,
        [this.fbOptions.flow.currentNodeId]:this.chooseInfo,
      };
    },
  },
};
</script>

<style lang="scss" scoped>
.head {
  height: 40px;
  text-align: center;
  line-height: 40px;
  color: #333;
  font-weight: bold;
  font-size: 14px;
  background-color: #ccc;
  margin-bottom: 16px;
}
.el-form-item {
  margin-bottom: 0px;
}
.radio-group {
  .el-radio {
    margin-top: 10px;
  }
}
</style>
